package com.example.lock;

import java.util.concurrent.locks.ReentrantLock;

/**
 * 可重入性
 * 
 * @author pingxu
 *
 */
public class ReentrantLockTest {

	public static void main(String[] args) {
		ReentrantLock lock = new ReentrantLock();

		for (int i = 1; i <= 3; i++) {
			lock.lock();
			System.out.println("lock ");
		}

		for (int i = 1; i <= 3; i++) {
			try {
				System.out.println("unlock ---- ");
			} finally {
				lock.unlock();
			}
		}

	}

}
